#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    int giveGem(vector<int>& gem, vector<vector<int>>& operations) {
        for (auto& e : operations)
        {
            int add = gem[e[0]] / 2;
            gem[e[0]] -= add;
            gem[e[1]] += add;
        }
        int min = gem[0];
        int max = gem[0];
        for (int i = 0; i < gem.size(); i++)
        {
            if (min > gem[i])
            {
                min = gem[i];
            }
            if (max < gem[i])
            {
                max = gem[i];
            }
        }
        return max - min;
    }
};
int main()
{

	return 0;
}